class Blacklist < ActiveRecord::Base
  has_paper_trail :version => :paper_trail_version, :versions => :paper_trail_versions
  DOMAIN_REGEXP = /\A([a-z\d\-]+\.)+[a-z]{2,}\z/i
  IP_REGEXP = /\A((\d{1,2}|1\d{2}|2[0-4]\d|25[0-5])\.){3}(\d{1,2}|1\d{2}|2[0-4]\d|25[0-5])\z/
  attr_accessible :address, :is_active, :is_allowed, :terminal_group_id, :description
  validates :is_active, inclusion: { in: [true, false] }
  validates :is_allowed, inclusion: { in: [true, false] }

  after_initialize :init
  belongs_to :terminal_group

  def init
    self.is_active = true if self.is_active.nil?
    self.is_allowed = false if self.is_active.nil?
  end


end
